<template>
    <div class='router-div'>

      <div v-for="(item, index) in this.tableData"  @click="gotoStudyWord(index)">

        <mt-cell :title="item.part + '  =  ' + item.partTrans + '   <>   ' + item.word + '  =  ' + item.wordTrans" value=""></mt-cell>

      </div>
    </div>
</template>

<script>
    import common from "../../data/common"
    export default {
        name: "study-part",
        data() {
          return {
            currPage:0,
            totalPage:0,
            tableData:""
          };
        },
        methods: {
          getData(){
            var url = common.apidomain + "/word/getPartList"
              + "?&pageNum=" + this.currPage
            this.$http.get(url).then(ret=>{
              this.tableData = ret.body.data;
              this.totalPage = parseInt(this.tableData.total/100 + 1);
            },ret=>{
              this.$message(ret.body.msg);
            })
          },
          gotoStudyWord(index) {
            this.$router.push({path:"/word/word",query:{'index':index, 'currPage':this.currPage}})
          }
        },
      created() {
          this.currPage = this.$route.params.currPage;
          this.getData();
      }
    }
</script>

<style scoped>

</style>
